import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/search_game_list_entity.dart';

SearchGameListEntity $SearchGameListEntityFromJson(Map<String, dynamic> json) {
  final SearchGameListEntity searchGameListEntity = SearchGameListEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    searchGameListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    searchGameListEntity.msg = msg;
  }
  final List<SearchGameListData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<SearchGameListData>(e) as SearchGameListData)
      .toList();
  if (data != null) {
    searchGameListEntity.data = data;
  }
  return searchGameListEntity;
}

Map<String, dynamic> $SearchGameListEntityToJson(SearchGameListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension SearchGameListEntityExtension on SearchGameListEntity {
  SearchGameListEntity copyWith({
    int? code,
    String? msg,
    List<SearchGameListData>? data,
  }) {
    return SearchGameListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

SearchGameListData $SearchGameListDataFromJson(Map<String, dynamic> json) {
  final SearchGameListData searchGameListData = SearchGameListData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    searchGameListData.id = id;
  }
  final int? isSelf = jsonConvert.convert<int>(json['is_self']);
  if (isSelf != null) {
    searchGameListData.isSelf = isSelf;
  }
  final String? imgUrl = jsonConvert.convert<String>(json['img_url']);
  if (imgUrl != null) {
    searchGameListData.imgUrl = imgUrl;
  }
  final String? isDeductible = jsonConvert.convert<String>(json['is_deductible']);
  if (isDeductible != null) {
    searchGameListData.isDeductible = isDeductible;
  }

  final String? addTime = jsonConvert.convert<String>(json['add_time']);
  if (addTime != null) {
    searchGameListData.addTime = addTime;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    searchGameListData.title = title;
  }
  final String? baopei = jsonConvert.convert<String>(json['baopei']);
  if (baopei != null) {
    searchGameListData.baopei = baopei;
  }

  final String? categoryText = jsonConvert.convert<String>(
      json['category_text']);
  if (categoryText != null) {
    searchGameListData.categoryText = categoryText;
  }
  final String? sellPrice = jsonConvert.convert<String>(json['sell_price']);
  if (sellPrice != null) {
    searchGameListData.sellPrice = sellPrice;
  }
  final int? totalcount = jsonConvert.convert<int>(json['totalcount']);
  if (totalcount != null) {
    searchGameListData.totalcount = totalcount;
  }
  final String? isMsg = jsonConvert.convert<String>(json['is_msg']);
  if (isMsg != null) {
    searchGameListData.isMsg = isMsg;
  }
  final String? isBystages = jsonConvert.convert<String>(json['is_bystages']);
  if (isBystages != null) {
    searchGameListData.isBystages = isBystages;
  }
  final String? updateTime = jsonConvert.convert<String>(json['update_time']);
  if (updateTime != null) {
    searchGameListData.updateTime = updateTime;
  }
  return searchGameListData;
}

Map<String, dynamic> $SearchGameListDataToJson(SearchGameListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['is_self'] = entity.isSelf;
  data['img_url'] = entity.imgUrl;
  data['add_time'] = entity.addTime;
  data['is_deductible'] = entity.isDeductible;
  data['baopei'] = entity.baopei;
  data['title'] = entity.title;
  data['category_text'] = entity.categoryText;
  data['sell_price'] = entity.sellPrice;
  data['totalcount'] = entity.totalcount;
  data['is_msg'] = entity.isMsg;
  data['is_bystages'] = entity.isBystages;
  data['update_time'] = entity.updateTime;
  return data;
}

extension SearchGameListDataExtension on SearchGameListData {
  SearchGameListData copyWith({
    int? id,
    int? isSelf,
    String? imgUrl,
    String? addTime,
    String? title,
    String? categoryText,
    String? sellPrice,
    String? isDeductible,
    String? baopei,
    int? totalcount,
    String? isMsg,
    String? isBystages,
    String? updateTime,
  }) {
    return SearchGameListData()
      ..id = id ?? this.id
      ..isSelf = isSelf ?? this.isSelf
      ..baopei = baopei ?? this.baopei
      ..isDeductible = isDeductible ?? this.isDeductible
      ..imgUrl = imgUrl ?? this.imgUrl
      ..addTime = addTime ?? this.addTime
      ..title = title ?? this.title
      ..categoryText = categoryText ?? this.categoryText
      ..sellPrice = sellPrice ?? this.sellPrice
      ..totalcount = totalcount ?? this.totalcount
      ..isMsg = isMsg ?? this.isMsg
      ..isBystages = isBystages ?? this.isBystages
      ..updateTime = updateTime ?? this.updateTime;
  }
}